import request from "@/utils/request";

export const login = (user) =>
    request({
        url: "/user/login",
        method: "POST",
        data: user,
    });

export const register = (user) =>
    request({
        url: "/user/register",
        method: "POST",
        data: user,
    });

export const allUser = (uid) =>
    request({
        url: `/user/getUserList/${uid}`,
        method: "GET",
        xhrFields: { withCredentials: true },
    });

export const deleteUser = (uid) =>
    request({
        url: `/user/delete/${uid}`,
        method: "DELETE",
    });

export const updateUser = (user) =>
    request({
        url: "/user/update",
        method: "PUT",
        data: user,
    });

export const collect = (uid, gid) =>
    request({
        url: `/user/collect/${uid}/${gid}`,
        method: "GET"
    })

export const getCollectList = (uid) =>
    request({
        url: `/user/getCollectList/${uid}`,
        method: "GET"
    })

export const cancelCollect = (uid, gid) =>
    request({
        url: `/user/cancelCollect/${uid}/${gid}`,
        method: "GET"
    })

export const addOrder = (order) =>
    request({
        url: "/user/addOrder",
        data: order,
        method: "POST"
    })

export const getSelfOrderList = (uid) =>
    request({
        url: `/user/getSelfOrderList/${uid}`,
        method: "GET"
    })